<?php


namespace backend\modules\demo\controllers;

use backend\jobs\DownloadJob;
use yii\web\Controller;

/**
 * Default controller for the `demo` module
 */
class JobController extends Controller
{
    /**
     * Renders the index view for the module
     * @return string
     */
    public function actionIndex()
    {
        return $this->render('index');
    }

    public function actionJob(){

        $id=  Yii::$app->queue3->push(new DownloadJob([
            'url' => 'http://img.sccnn.com/bimg/341/171348.jpg',
            'file' => '/tmp/image445.jpg',
        ]));

        var_dump($id);
        Yii::$app->queue->isWaiting($id);

// Check whether a worker got the job from the queue and executes it.
        Yii::$app->queue->isReserved($id);

// Check whether a worker has executed the job.
        Yii::$app->queue->isDone($id);die;
    }
}
